﻿using System;
using System.Net.Sockets;

namespace PacketRush.Core
{
    /// <summary>
    /// Describes an error event.
    /// </summary>
    public class NetErrorEventArgs : EventArgs
    {
        /// <summary>
        /// The connection that caused the error.
        /// </summary>
        public INetConnection Connection { get; set; }

        /// <summary>
        /// The socket error that occured.
        /// </summary>
        public SocketError SocketErrorCode { get; set; }

        /// <summary>
        /// Create an instance of <c>NetErrorEventArgs</c>.
        /// </summary>
        /// <param name="connection">The connection that caused the error.</param>
        /// <param name="errorCode">The socket error code that describes the error that occured.</param>
        public NetErrorEventArgs(INetConnection connection, SocketError errorCode)
        {
            Connection = connection;
            SocketErrorCode = errorCode;
        }
    }
}
